<template>
	<!-- 银行卡 -->
	<view class="" v-if="time<time2"></view>
	<view v-else>
		<view class="head bg-white">
			<view class="title">
				<text class="text">银行卡账号</text>
				<view class="view flex-cb">
					<input type="number" placeholder="请输入添加银行卡号" class="input" v-model="bank_card_number">
				</view>
			</view>
			<view class="title">
				<text class="text">开户行</text>
				<view class="view flex-cb">
					<input type="text" placeholder="请输入开卡开户行" class="input" v-model="bank_name">
				</view>
			</view>
			<view class="title">
				<text class="text">持卡人姓名</text>
				<view class="view flex-cb">
					<input type="text" placeholder="请输入持卡人姓名" class="input" v-model="bank_card_username">
				</view>
			</view>
			<view class="button flex-c " @click="handleYes">确定</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bank_name:'',
				bank_card_number:'',
				bank_card_username:'',
				time:'',
				time2:''
			};
		},
		onLoad() {
			this.time = Date.parse(new Date()) /1000
			this.time2 = this.$time
			if(this.time<this.time2){
				uni.setNavigationBarTitle({
					title:''
				})
			}
		},
		methods:{
			handleYes(){
				if(this.bank_name == ''){
					this.$utils.tips('请填写开户行名称')
					return
				}
				if(this.bank_card_number == ''){
					this.$utils.tips('请填写银行卡卡号')
					return
				}
				if(this.bank_card_username == ''){
					this.$utils.tips('请填写持卡人姓名')
					return
				}
				uni.showModal({
					confirmColor:'#1CD699',
					content:'核对信息无误并提交',
					title:'提示',
					success:(res)=>{
							if (res.confirm) {
								this.$api.add_bank({
									bank_name:this.bank_name,
									bank_card_number:this.bank_card_number,
									bank_card_username:this.bank_card_username,
								},1).then(res=>{
									if(res.code == 200001){
										this.$utils.tips('添加成功')
										uni.navigateBack({
											delta:1
										})
									}
								})
							}
						}
				})
			}
		}
	}
</script>

<style lang="scss">
	.head{
		padding: 30rpx 36rpx;
		margin-top: 1rpx;
		min-height: 100vh;
	}
.title{
		margin-top: 30rpx;
		.view{
			width: 682rpx;
			height: 80rpx;
			margin-top: 20rpx;
			background: #F8F8F8;
			border-radius: 10rpx;
			padding-left: 22rpx;
			padding-right: 32rpx;
			.Price,.input{
				width: 630rpx;
			}
			.input{
				
			}
		}
		
	}
.button{
	width: 648rpx;
	height: 80rpx;
	background: #1CD699;
	border-radius: 10rpx;
	margin-top: 451rpx;
	color: #fff;font-weight: bold;
	font-size: 28rpx;
}
</style>
